feat(clients): add PR auto-settle toggle - #5141
Conversation
📝 WalkthroughWalkthroughThe change adds a separate setting for automatic settlement after merged or closed change requests. Web and mobile settings expose both settlement triggers. Runtime and Thread List v2 classification apply the preferences and preserve manual settlement behavior. ChangesThread settlement contract and runtime
Web controls and consumers
Mobile Thread List v2
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant SettingsPanel
participant ClientSettings
participant SidebarV2
participant effectiveSettled
SettingsPanel->>ClientSettings: update merged/closed auto-settle setting
ClientSettings->>SidebarV2: provide setting
SidebarV2->>effectiveSettled: evaluate thread state and preference
effectiveSettled-->>SidebarV2: settled or active classification
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review New feature adding a user-facing settings toggle across web, mobile, and desktop that changes thread auto-settlement behavior. Cross-platform feature additions warrant human review. You can customize Macroscope's approvability policy. Learn more. |
1f2d7cb to
2585df2
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2585df2. Configure here.
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/mobile/src/features/threads/threadListV2.ts (1)
33-39: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse inferred return types.
Both functions infer their return shape from the returned object.
apps/mobile/src/features/threads/threadListV2.ts#L33-L39: Remove the explicit return type fromresolveThreadListV2SettlementPreferences.apps/mobile/src/features/threads/use-thread-list-v2-enabled.ts#L25-L28: Remove the explicit return type fromuseThreadListV2SettlementPreferences.As per coding guidelines, “Prefer inferred types over explicit annotations and do not use
any.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/mobile/src/features/threads/threadListV2.ts` around lines 33 - 39, Remove the explicit return type annotation from resolveThreadListV2SettlementPreferences in apps/mobile/src/features/threads/threadListV2.ts (lines 33-39) and useThreadListV2SettlementPreferences in apps/mobile/src/features/threads/use-thread-list-v2-enabled.ts (lines 25-28), allowing both functions to infer their return shapes from the returned objects.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/mobile/src/features/threads/threadListV2.ts`:
- Around line 33-39: Remove the explicit return type annotation from
resolveThreadListV2SettlementPreferences in
apps/mobile/src/features/threads/threadListV2.ts (lines 33-39) and
useThreadListV2SettlementPreferences in
apps/mobile/src/features/threads/use-thread-list-v2-enabled.ts (lines 25-28),
allowing both functions to infer their return shapes from the returned objects.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 897164d0-2c77-4240-8eef-04ade8e5f5c0
📒 Files selected for processing (18)
apps/desktop/src/settings/DesktopClientSettings.test.tsapps/mobile/src/features/home/HomeScreen.tsxapps/mobile/src/features/settings/SettingsRouteScreen.tsxapps/mobile/src/features/threads/ThreadNavigationSidebar.tsxapps/mobile/src/features/threads/threadListV2.test.tsapps/mobile/src/features/threads/threadListV2.tsapps/mobile/src/features/threads/use-thread-list-v2-enabled.tsapps/mobile/src/persistence/mobile-preferences.tsapps/web/src/components/ChatView.tsxapps/web/src/components/SidebarV2.tsxapps/web/src/components/settings/BetaSettingsPanel.tsxapps/web/src/components/settings/settingsSearch.test.tsapps/web/src/components/settings/settingsSearch.tsdocs/user/source-control.mdpackages/client-runtime/src/state/threadSettled.test.tspackages/client-runtime/src/state/threadSettled.tspackages/contracts/src/settings.test.tspackages/contracts/src/settings.ts

What Changed
Closes #4982.
Why
Sidebar v2 previously classified merged and closed pull-request threads as settled unconditionally. Disabling “Auto-settle inactive threads” therefore could not keep those threads active for follow-up work.
The merged/closed trigger is now configurable independently from the inactivity trigger. Existing users keep the current behavior unless they opt out.
This composes with #5151: open PRs remain protected from inactivity auto-settle; this setting only controls the merged/closed completion trigger.
UI Changes
Before
The inactivity setting also stated that merged and closed PR threads always settle, with no separate control.
After
A separate toggle controls merged/closed-PR settlement. Here it is disabled while inactivity-based settlement remains enabled.
Validation
bun test packages/contracts/src/settings.test.ts packages/client-runtime/src/state/threadSettled.test.ts apps/mobile/src/features/threads/threadListV2.test.ts— 251 passedbun --cwd apps/web test -- src/components/settings/settingsSearch.test.ts— 8 passedbun --cwd apps/desktop test -- DesktopClientSettings.test.ts— 7 passedChecklist
Built with GPT-5.6-Sol via the Codex harness in T3 Code.
Note
Add auto-settle toggle for merged/closed PR threads across web and mobile
sidebarAutoSettleOnChangeRequestCompletiontoClientSettingsSchema(defaulttrue) so users can disable auto-settling threads when a PR is merged or closed.effectiveSettledto gate the PR-completion branch on the new flag; existing behavior is unchanged when the flag is omitted.BetaSettingsPanel, wires it throughuseClientThreadSettlementPreferencesintoSidebarV2andChatView.threadListV2AutoSettleInactive,threadListV2AutoSettleOnChangeRequestCompletion), exposed via toggles inSettingsRouteScreenand consumed byHomeScreenandThreadNavigationSidebar.Macroscope summarized 2689452.
Summary by CodeRabbit
New Features
Documentation
Bug Fixes
Note
Low Risk
Preference and UI changes around thread list classification; defaults preserve existing behavior and settlement logic is covered by targeted tests.
Overview
Adds
sidebarAutoSettleOnChangeRequestCompletion(default on) so merged/closed PR auto-settling is no longer tied to the inactivity setting.effectiveSettledonly auto-settles on terminal PR states when that flag is enabled; manual settle, open-PR inactivity blocking, and the inactivity window stay unchanged.Web/desktop expose a separate Beta toggle and
useClientThreadSettlementPreferences(hydration-safe) feeds Sidebar v2, ChatView, and settings search. Mobile mirrors the two triggers via device-local preferences,resolveThreadListV2SettlementPreferences, and switches under Thread List v2 Beta.User docs describe controlling both automatic settle paths independently.
Reviewed by Cursor Bugbot for commit 2689452. Bugbot is set up for automated code reviews on this repo. Configure here.